// TestString.cpp : Defines the entry point for the console application.
//

#include <cstring>
#include <stdlib.h>
#include <locale.h>
#include <string>
#include "myString.h"

int main(int argc, char* argv[])
{
         char* loc = setlocale(LC_ALL,"en_US.utf8");
         printf("the locale is %s\n", loc);
         //constructor
	 myString test("hello!");
         printf("constructor: %s\n", test.m_str);
         //copy constructor
	 myString test2(test);
         printf("copy constructor:%s\n", test2.m_str);
         //operator constructor
	 myString test3;
         test3 = test;
         printf("operator construtor:%s\n", test3.m_str);
	 //print the i elem
         int i = 3;
         printf("at(%d) = %c \n", i, test.at(i));
         //print length
	 printf("length = %d \n", test.length());
         //find substr
	 int pos = test.find("o!");
         printf("the \" o! \" pos = %d\n", pos);
         //concat the string
	 myString test4 = test.concat("abc");
	 printf("concat(abc) = %s\n", test4.m_str);
         //repalce the string
	 myString test5 = test.replace("he","A");
         printf("replace he  with A the string: %s\n", test5.m_str);
   
	return 0;
}

